<template>
  <div class="yingmoo-store">
    <ul class="nav">
      <router-link tag="li" to="/ymMemberneedlist">投放单</router-link>
      <router-link tag="li" to="/ymMemberenquiry">询价单</router-link>
      
      <el-button type="text" @click="centerDialogVisible = true">免费申请</el-button>

      <el-dialog
        title="请填写你的需求描述"
        :visible.sync="centerDialogVisible"
        width="30%"
        center>
        <textarea rows="10" cols="55" v-model="requireForm.description" placeholder="请填写你的需求描述" style="outline:inherit;">
        </textarea>
        <span slot="footer" class="dialog-footer">
          <!--<router-link tag="el-button" to="/ymMemberneedlist" type="primary" @click="centerDialogVisible = false,createRequireForm()">提 交</router-link>-->
          <el-button @click="createRequireForm">提交</el-button>
          <el-button @click="centerDialogVisible = false">取 消</el-button>
        </span>
      </el-dialog>
    </ul>
    <div class="error">
      <p>
        您还没有投放单哦，快去免费申请吧！
      </p>
      <img src="../assets/ym-member/arrows.png" class="arrows" />
    </div>
  </div>
</template>

<script>
  export default {
    name: "yingmoo-store",
    data() {
      return {
      	requestAddr:this.GLOBAL.addr,
        centerDialogVisible: false,
        requireForm:{}
      };
    },
    mounted(){
    	
    },
    methods:{
    	createRequireForm:function(){
    		this.user = JSON.parse(localStorage.getItem("user"));
    		this.requireForm.memberId = this.user.autoId;
    		this.requireForm.status = 0;
    		this.requireForm.type = 1 ;
    		this.$http.post(this.requestAddr+"/GetJson/createRequireForm",this.requireForm,{emulateJSON:true}).then(
    			(res)=>{
    				if(res.data.code == 0){
    					this.$confirm('您的需求已成功提交！', '成功提示', {
			          confirmButtonText: '确定',
			          cancelButtonText: '取消',
			          type: 'warning' 
			        }).then(
			        	()=>{
			        		this.centerDialogVisible = false
			        		window.location.href="../#/ymMemberneedlist"
			        	}
			        )
    				}
    			}
    		)
    	}
    }
  }
</script>

<style scoped>
  .el-button--text{
    width: 103px;
    height: 30px;
    font-size: 16px;
    line-height: 30px;
    color: white;
    background-color: #f29600;
    text-align: center;
    border-radius: 7px;
    margin-left: 820px;
    cursor: pointer;
  }
  .el-button--text{
    padding-top: 0;
  }
  .el-dialog__title{
    text-align: inherit !important;
    color: #036eb7;
  }
</style>
<style scoped lang="less">
.yingmoo-store{
  width: 100%;
  .nav{
    width: 1200px;
    height: 46px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    background-color: #f2f2f2;
    margin-top: 20px;
    li{
      list-style: none;
      width: 90px;
      height: 30px;
      margin: 0 20px;
      line-height: 30px;
      color: #666666;
      text-align: center;
      font-size: 16px;
      cursor: pointer;
      &:hover{
        background-color: #036eb7;
        color: white;
      }
      &:nth-child(1){
        background-color: #036eb7;
        color: white;
      }
    }
    .uploading{
      width: 103px;
      font-size: 16px;
      color: white;
      background-color: #f29600;
      text-align: center;
      border-radius: 7px;
      margin-left: 820px;
      cursor: pointer;
    }
  }
  .error{
    width: 1200px;
    height: 665px;
    background-color: white;
    margin: 0 auto;
    p{
      width: 500px;
      line-height: 30px;
      font-size: 17px;
      color: #333333;
      padding-left: 455px;
      padding-top: 120px;
    }
    .arrows{
      position: relative;
      left: 780px;
      bottom: 80px;
    }
  }
}
</style>
